import { Component } from '@angular/core';
import { ApesField } from './apes-field';
import { ApiService } from '@core/services/http/api.service';
import { Events } from '@core/services/events/Events';
import { ExpressionService } from '@core/services/expression/ExpressionService';
import { SubjectService } from '@core/services/events/subject.service';
import { getO } from '../../../../utils/utils';

@Component({
  selector: 'formly-field-checkbox-group',
  template: `
    <checkbox [formControl]="formControl"
              [disabled]="to.disabled"
              [items]="items">
    </checkbox>
  `,
})
export class FormlyFieldCheckboxGroup extends ApesField {

  items: any[] = [];

  constructor(protected apiService: ApiService, protected events: Events, protected expressionService: ExpressionService, protected subject: SubjectService) {
    super(apiService, events, expressionService, subject);
  }

  ngOnInit() {
    this.items = getO(this.to['items']);
  }

}
